package com.amos.cmp_android.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.ImageView;

import com.amos.cmp_android.R;

/**
 * Created by Amos on 2016/4/13.
 */
public class EmailActivity extends AppCompatActivity {

    private ImageButton qqMail;
    private ImageButton outlookMail;
    private ImageButton a163Mail;
    private ImageButton a126Mail;
    private View.OnClickListener listener;
    private Intent intent;

    private String qqurl = "https://ui.ptlogin2.qq.com/cgi-bin/login?style=9&appid=522005705&daid=4&" +
            "s_url=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%" +
            "26delegate_url%3D%26f%3Dxhtml%26target%3D&hln_css=http%3A%2F%2Fmail.qq.com%2Fzh_CN%" +
            "2Fhtmledition%2Fimages%2Flogo%2Fqqmail%2Fqqmail_logo_default_200h.png&low_login=1&" +
            "hln_autologin=%E8%AE%B0%E4%BD%8F%E7%99%BB%E5%BD%95%E7%8A%B6%E6%80%81&pt_no_onekey=1";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_email);

        qqMail = (ImageButton) findViewById(R.id.qq_mail);
        outlookMail = (ImageButton) findViewById(R.id.outlook_mail);
        a163Mail = (ImageButton) findViewById(R.id.a163_mail);
        a126Mail = (ImageButton) findViewById(R.id.a126_mail);

        intent = new Intent(EmailActivity.this, ShowEmailActivity.class);

        listener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int id = v.getId();
                switch (id){
                    case R.id.qq_mail:intent.putExtra("url", qqurl);break;
                    case R.id.outlook_mail:intent.putExtra("url", "https://www.outlook.com/");break;
                    case R.id.a163_mail:intent.putExtra("url", "http://smart.mail.163.com/?dv=smart");break;
                    case R.id.a126_mail:intent.putExtra("url", "http://smart.mail.126.com/?dv=smart");break;
                }
                startActivity(intent);
            }
        };

        qqMail.setOnClickListener(listener);
        outlookMail.setOnClickListener(listener);
        a163Mail.setOnClickListener(listener);
        a126Mail.setOnClickListener(listener);

    }

}
